import request from '@/utils/request';
export const selectAllproduct = (params: any) => {
    return request({
      url: `api/selectAllproduct`,
      method: 'get'
    });
  };
  export const selectAllproductsByID = (fid: any) => {
    return request({
      url: `api/selectAllproductByID?fid=${fid}`,
      method: 'get'
    });
  };

  export const handleBuy=(params: any) => {
    return request({
      url: `api/buyProducts`,
      method: 'post',
      data:{
        "uid":params.uid,
        "pid":params.pid,
        "fid":params.fid,
        "pname":params.pname
      }
    });
  };
  export const selectBuyRecord = (uid:any) => {
    return request({
      url: `api/buyRecords?uid=${uid}`,
      method: 'get',
    });
  };

  export const launchProduct = (params:any)=>{
    return request({
      url:`api/launchProduct`,
      method:'post',
      data: params, // 使用 FormData
    })
  }

  export const updateProduct = (params:any)=>{
    return request({
      url:`api/updateProduct`,
      method:'post',
      data: params, // 使用 FormData
    })
  }

  export const deleteProduct = (deleteid:any)=>{
    return request({
      url:`api/deleteProduct?deleteid=${deleteid}`,
      method:'get',
    })
  }
  
  export const getProductSelling = () => {
    return request({
      url: `api/getProductSelling`,
      method: 'get',
    });
  };
  export const getHotelSelling = () => {
    return request({
      url: `api/getHotelSelling`,
      method: 'get',
    });
  };
  export const getRecommendProduct = () => {
    return request({
      url: `api/getRecommendProduct`,
      method: 'get',
    });
  };